
package com.kweative.model.column;

import com.kweative.model.Table;
import com.kweative.model.sql.SQLDataType;

/**
 *
 * @author henrik
 */
public class ColumnBoolean<T extends Table> extends Column<ColumnBoolean,T> {
    public ColumnBoolean(String name) {
        this();
		setName(name);
    }

	public ColumnBoolean() {
		super(Boolean.class);
		setSQLDataType(SQLDataType.TINYINT);
		setSQLTypeParms("1");
		setSQLDefault(Boolean.FALSE);
	}


    @Override
    public String serialize(Object value) {
        Boolean b = (Boolean) value;
        return (b) ? "1" : "0";
    }

    @Override
    public Boolean unserialize(String value) {
        return Boolean.valueOf(value);
    }


}
